<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    let url = '/my/login'
    // indexOf方法是检测字符串中是否有某个字符(找到就返回), 检测到返回对应的索引, 检测不到返回-1
    // console.log(url.indexOf('/'))

    // startsWith('字符') 检测字符串是否以某个字符开始, 如果是就返回true
    console.log(url.startsWith('/api'))
    // endsWith('字符')检测字符串是否以某个字符结尾, 如果是就返回true
    console.log(url.endsWith('n'))
    // includes('字符') 检测字符串是否包含某个字符如果是就返回true
    console.log(url.includes('n'))
  </script>
</body>
</html>